package qeb.handheldmedical.patient;

import org.json.JSONArray;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;
import qeb.handheldmedical.R;
import qeb.handheldmedical.adapter.ConsultationAdapter;
import qeb.handheldmedical.adapter.SlideListView;
import qeb.handheldmedical.helper.WSHelper;
import qeb.handheldmedical.model.InPatient;

public class ConsultationList extends Activity {
	private SlideListView slideListView;
	private ConsultationAdapter adapter;
	InPatient ip=new InPatient();
	private JSONArray yzJsonArray;
	
	private Button btn_title_back;
	private TextView tv_title; 
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);
		ip = (InPatient)getIntent().getSerializableExtra("patientinfo");
		setContentView(R.layout.query_consultation);
		initView();
		 dataBind();
	}
	
	private void initView()
	{
		slideListView = (SlideListView) findViewById(R.id.slideListView8);
		tv_title=(TextView)findViewById(R.id.tv_top_title);
		tv_title.setText(ip.XM+"的会诊单");
		btn_title_back=(Button)findViewById(R.id.btn_title_back);
		btn_title_back.setOnClickListener(MyOnClickListener);

	}
	
	/*系统主菜单点击事件（在院病人、门诊病人等）*/
	private OnClickListener MyOnClickListener=new OnClickListener(){		
		@Override
		public void onClick(View v) {
			// TODO 自动生成的方法存根
			//Bundle bundle=new Bundle();
			switch (v.getId()) {
			case R.id.btn_title_back://返回按钮
				ConsultationList.this.finish();
				break;
			default:
				break;		
			}
		}
	};
	private void dataBind()
	{
		yzJsonArray = WSHelper.GetXtList(ip.ZYXH);
		if (yzJsonArray != null && yzJsonArray.length() > 0) {
			adapter = new ConsultationAdapter(yzJsonArray.length(),
					ConsultationList.this, yzJsonArray);			
			slideListView.setAdapter(adapter);
		}
	}
}